<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Python Debugging Builds</title>
<link rel="stylesheet" href="../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Boost.Python">
<link rel="up" href="../building.html" title="Chapter 2. Building and Testing">
<link rel="prev" href="include_issues.html" title="#include Issues">
<link rel="next" href="testing_boost_python.html" title="Testing Boost.Python">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="" width="" height="" src="../images/boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="include_issues.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../building.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="testing_boost_python.html"><img src="../images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="building.python_debugging_builds"></a><a class="link" href="python_debugging_builds.html" title="Python Debugging Builds">Python Debugging Builds</a>
</h3></div></div></div>
<p>
        Python can be built in a special “python debugging” configuration that
        adds extra checks and instrumentation that can be very useful for developers
        of extension modules. The data structures used by the debugging configuration
        contain additional members, so <span class="bold"><strong>a Python executable
        built with python debugging enabled cannot be used with an extension module
        or library compiled without it, and vice-versa.</strong></span>
      </p>
<p>
        Since pre-built “python debugging” versions of the Python executable
        and libraries are not supplied with most distributions of Python, <a href="#ftn.building.python_debugging_builds.f0" class="footnote" name="building.python_debugging_builds.f0"><sup class="footnote">[5]</sup></a> and we didn't want to force our users to build them, Boost.Build
        does not automatically enable python debugging in its <code class="computeroutput"><span class="identifier">debug</span></code>
        build variant (which is the default). Instead there is a special build property
        called <code class="computeroutput"><span class="identifier">python</span><span class="special">-</span><span class="identifier">debugging</span></code> that, when used as a build property,
        will define the right preprocessor symbols and select the right libraries
        to link with.
      </p>
<p>
        On unix-variant platforms, the debugging versions of Python's data structures
        will only be used if the symbol <code class="computeroutput"><span class="identifier">Py_DEBUG</span></code>
        is defined. On many windows compilers, when extension modules are built with
        the preprocessor symbol <code class="computeroutput"><span class="identifier">_DEBUG</span></code>,
        Python defaults to force linking with a special debugging version of the
        Python DLL. Since that symbol is very commonly used even when Python is not
        present, Boost.Python temporarily undefines <code class="computeroutput"><span class="identifier">_DEBUG</span></code>
        when <code class="computeroutput"><span class="identifier">Python</span><span class="special">.</span><span class="identifier">h</span></code> is #included from <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">python</span><span class="special">/</span><span class="identifier">detail</span><span class="special">/</span><span class="identifier">wrap_python</span><span class="special">.</span><span class="identifier">hpp</span></code> -
        unless <code class="computeroutput"><span class="identifier">BOOST_DEBUG_PYTHON</span></code>
        is defined. The upshot is that if you want “python debugging”and you
        aren't using Boost.Build, you should make sure <code class="computeroutput"><span class="identifier">BOOST_DEBUG_PYTHON</span></code>
        is defined, or python debugging will be suppressed.
      </p>
<div class="footnotes">
<br><hr style="width:100; text-align:left;margin-left: 0">
<div id="ftn.building.python_debugging_builds.f0" class="footnote"><p><a href="#building.python_debugging_builds.f0" class="para"><sup class="para">[5] </sup></a>
          On Unix and similar platforms, a debugging python and associated libraries
          are built by adding --with-pydebug when configuring the Python build. On
          Windows, the debugging version of Python is generated by the "Win32
          Debug" target of the Visual Studio project in the PCBuild subdirectory
          of a full Python source code distribution.
        </p></div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2002-2015 David
      Abrahams, Stefan Seefeld<br>Copyright © 2002-2015 David Abrahams, Stefan Seefeld<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="include_issues.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../building.html"><img src="../images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../images/home.png" alt="Home"></a><a accesskey="n" href="testing_boost_python.html"><img src="../images/next.png" alt="Next"></a>
</div>
</body>
</html>
